
local gmod_drawhelp = CreateClientConVar( "gmod_drawhelp", "1", true, false )
gmod_toolmode = CreateClientConVar( "gmod_toolmode", "rope", true, true )

include('shared.lua')
include('cl_viewscreen.lua')

SWEP.PrintName			= "Interaction"			
SWEP.Slot				= 0	
SWEP.SlotPos			= 0
SWEP.DrawAmmo			= false
SWEP.DrawCrosshair		= true

SWEP.Spawnable			= false
SWEP.AdminSpawnable		= false
SWEP.CaptionHeight		= -50
SWEP.ToolNameHeight		= 0
SWEP.InfoBoxHeight		= 0

/*---------------------------------------------------------
	Draws the help on the HUD (disabled if gmod_drawhelp is 0)
---------------------------------------------------------*/
function SWEP:DrawHUD()

	local currentState = self:GetState()

	if currentState == "" then
		return
	end

	if currentState != STATE_INTERACT then

		if self.CaptionHeight < 0 then
			self.CaptionHeight = self.CaptionHeight + 2.75
		end

		local x, y = 30, self.CaptionHeight
		local w, h = 0, 0
		
		local QuadTable = {}
		
		QuadTable.color		= Color( 10, 10, 10, 220 )
		QuadTable.x = 0
		QuadTable.y = y
		QuadTable.w = ScrW()
		QuadTable.h = 50
		draw.TexturedQuad( QuadTable )

		local niceStateName = ""
		local niceSubstateName = ""

		if currentState == STATE_CREATE_ANIMATION_CAMERA then
			niceStateName = "Currently creating an 'Animated Camera'"
			niceSubstateName = "Camera Name: " .. tostring(MODE_ANICAMERA.CurrentName)
		elseif currentState == STATE_CREATE_STILL_CAMERA then
			niceStateName = "Currently creating a 'Static Camera'"
			niceSubstateName = "Camera Name: " .. tostring(MODE_STATIC_CAMERA.CurrentName)
		elseif currentState == STATE_CREATE_ACTOR_SEQUENCE then
			niceStateName = "Currently creating an 'Actor Sequence'"
			niceSubstateName = "Sequence Name: " .. tostring(MODE_ACTORSEQUENCE.CurrentName)
		elseif currentState == STATE_GATHER_SEQUENCE_ACTORS then
			niceStateName = "Currently selecting actors for 'Actor Sequence'"
			niceSubstateName = "Reclick 'Select Actors' in the 'Roleplay Setup' control panel to stop selecting actors "
		elseif currentState == STATE_GATHER_CAMERA_SEQUENCES then
			niceStateName = "Currently selecting actor roleplays for 'Animated Camera'"
			niceSubstateName = "Reclick 'With roleplay' in the 'Camera Configuration' control panel to stop selecting role-plays"
		end

		
		local TextTable = {}
		TextTable.font = "Trebuchet20"
		TextTable.color = Color( 240, 240, 240, 255 )
		TextTable.pos = { x, y + 6.25 }
		TextTable.text = niceStateName
		
		w, h = draw.Text( TextTable )
		y = y + h
		
		TextTable.font = "Trebuchet18"
		TextTable.color = Color( 200, 210, 200, 255 )
		TextTable.pos = { x, y + 6.25}
		TextTable.text = niceSubstateName
		w, h = draw.Text( TextTable )
		y = y + h + 8
	
	else
		if self.CaptionHeight > -50 then
			self.CaptionHeight = self.CaptionHeight  - 2.75

			local x, y = 30, self.CaptionHeight
			local w, h = 0, 0
			
			local QuadTable = {}
			
			QuadTable.color		= Color( 10, 10, 10, 220 )
			QuadTable.x = 0
			QuadTable.y = y
			QuadTable.w = ScrW()
			QuadTable.h = 50
			draw.TexturedQuad( QuadTable )

		end
	end
end

function SWEP:SetStage( ... )

	if ( !self:GetToolObject() ) then return end
	return self:GetToolObject():SetStage( ... )
	
end

function SWEP:GetStage( ... )

	if ( !self:GetToolObject() ) then return end
	return self:GetToolObject():GetStage( ... )
	
end

function SWEP:ClearObjects( ... )

	if ( !self:GetToolObject() ) then return end
	self:GetToolObject():ClearObjects( ... )
	
end

function SWEP:StartGhostEntities( ... )

	if ( !self:GetToolObject() ) then return end
	self:GetToolObject():StartGhostEntities( ... )
	
end

function SWEP:PrintWeaponInfo( x, y, alpha )	
end

function SWEP:FreezeMovement()

	local mode = self:GetMode()
	
	if ( !self:GetToolObject() ) then return false end
	
	return self:GetToolObject():FreezeMovement()
	
end
